package net.wwang.open.config;

import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * @author WangWei
 * @date 2020/9/23
 */
public class MyWebMvcConfigurationSupport extends WebMvcConfigurationSupport {
    /**
     *
     * addResourceHandlers  静态资源配置方法
     *   1.效果和yml static-path-pattern 配置一致
     *   2.</test/**>为key 会覆盖static-path-pattern 相同的内容
     *
     * @param registry
     */
    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {

        registry.addResourceHandler("/test/**")
                .addResourceLocations("classpath:/resources/")
                .addResourceLocations("classpath:/static/")
                .addResourceLocations("classpath:/templates/")
                .addResourceLocations("classpath:/public/")
                .addResourceLocations("classpath:/test/");
        super.addResourceHandlers(registry);
    }
}
